<!-- 药品订单 -->
<template>
	<view class="wrapper">
		<view class="order-item" v-for="(item, index) in orderList" :key="index" @click="">
			<view class="image-wrapper">
				<image :src="item.cartlist[0].sthumb"></image>
			</view>
			<view class="content-wrapper">
				<p style="font-size: 1.1rem;">{{item.cartlist[0].sname}}</p>
				<p style="font-size: .8rem;">购买数量：{{item.num}}</p>
				<p style="color: #ff9800;">订单总额：￥{{item.totalMoney}}</p>
			</view>
		</view>
		
		<u-empty v-if="orderList.length == 0" mode="list" icon="http://cdn.uviewui.com/uview/empty/car.png">
		</u-empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList: []
			}
		},
		onLoad() {
			this.api_myorderlist()
		},
		methods: {
			api_myorderlist() {
				let openid = uni.getStorageSync('openid')
				this.$app._get('entry/wxapp/goods.myorderlist', {
					openid: openid,
					index: 0,//0全部1待支付2待发货3待收货4已完成
					pageidx: 1,
					pagesize: 1000
				}, (result) => {
					this.orderList = result
					console.log(result)
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.wrapper {
		padding: 15px;
		
		.order-item {
			display: flex;
			align-items: center;
			padding: 8px;
			background-color: #fff;
			border-radius: 6px;
		
			.image-wrapper {
				width: 30%;
				height: 100px;
				background-color: #eeeeee;
		
				image {
					width: 100%;
					height: 100%;
					border-radius: 6px;
					border: 1px solid #eee;
				}
			}
		
			.content-wrapper {
				display: flex;
				flex-direction: column;
				padding: 0 10px 0 10px;
				color: #757575;
				
				p {
					line-height: 25px;
				}
			}
		}
	}
</style>